package main

import "fmt"

//8, 3, 2, 9, 4, 6, 10, 0
//第一次选择最小的
//第二次选择第二小的
//第三次选择第三小的
//...
func select_sort(a [8]int) [8]int {
  for i := 0; i < len(a); i++ {
    for j := i + 1; j < len(a); j++ {
      if a[j] < a[i] {
        a[i], a[j] = a[j], a[i]
      }
    }
  }
  return a
}

func main() {
  var i [8]int = [8]int{8, 3, 2, 9, 4, 6, 10, 0}
  res := select_sort(i)
  fmt.Println(res) //[0 2 3 4 6 8 9 10]
}
